package com.tbitsglobal.client;

import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.ListBox;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class ChatHome extends Composite {
	private Button chatButton;
	private ListBox online;
	private DockPanel mainContent;
	private DockPanel container;
	private ConversationPage convPage;
	private SimplePanel messageHolder;
	private VerticalPanel panel;
	public ChatHome() {
		mainContent = new DockPanel();
		mainContent.add(TopPanel.get(), DockPanel.NORTH);
		
		online = new ListBox();
		chatButton = new Button("Chat");
		
		chatButton.addClickListener(new ClickListener(){

			public void onClick(Widget sender) {
				// TODO Auto-generated method stub
				startChat();
			}
		});
		
		panel = new VerticalPanel();
		panel.add(online);
		panel.add(chatButton);
		
		container = new DockPanel();
	
		
		messageHolder = new SimplePanel();
		
		
		mainContent.add(container, DockPanel.CENTER);
		convPage = new ConversationPage();
		
		openHome();
		initWidget(mainContent);
		
	}
	private void startChat() {
		// TODO Auto-generated method stub
		container.clear();
		container.add(convPage, DockPanel.CENTER);
	}
	
	private void openHome()
	{
		container.clear();
		container.add(panel, DockPanel.WEST);
		container.add(messageHolder, DockPanel.CENTER);
	}

}
